package org.game.manager;

import java.util.Map;
import java.util.Map.Entry;

import org.game.db.bean.Player;
import org.game.module.EnterGameHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.collect.Maps;

/**
 * @author : DengYing
 * @CreateDate : 2017年8月21日 下午2:47:36
 * @Description ：Please describe this document
 */
public class EnterGameManager {
	static final Logger log = LoggerFactory.getLogger(EnterGameManager.class);
	private Map<String, EnterGameHandler> maping = Maps.newHashMap();

	private EnterGameManager() {
	}

	private static EnterGameManager ME = new EnterGameManager();

	public static EnterGameManager me() {
		return ME;
	}
	
	public void register(EnterGameHandler impl){
		log.debug("EnterGameHandler： <{}>",impl.getClass().getName());
		maping.put(impl.getClass().getName(), impl);
	}

	public void sendEnterGameMsg(Player player){
		for (Entry<String, EnterGameHandler> entry : maping.entrySet()) {
			entry.getValue().enterGame(player);
		}
	}
}

